package org.springblade.wechat.feign;

import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.wechat.entity.MyWxMpTemplateMessage;
import org.springblade.wechat.service.IMpService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.HashMap;
import java.util.List;

/**
 * @author LK
 * @version 1.0.0
 * @Title: MpClient.java
 * @Description: TODO    微信公众号服务feign实现类
 * @date 2020/4/9 14:10
 */
@ApiIgnore
@RestController
@AllArgsConstructor
public class MpClient implements IMpClient {

	IMpService mpService;

	/**
	 * 发送微信公众号模板消息
	 *
	 * @param myWxMpTemplateMessageList
	 * @return
	 */
	@Override
	@GetMapping(API_PREFIX + "/sendWxMpTemplateMessage")
	public R<HashMap<String, Object>> sendWxMpTemplateMessage(String myWxMpTemplateMessageList, String xxlx) {
		return mpService.sendWxMpTemplateMessage(myWxMpTemplateMessageList, xxlx);
	}

	/**
	 * 根据微信公众号id和用户id获取openId
	 *
	 * @param mpId
	 * @param userId
	 * @return
	 */
	@Override
	@GetMapping(API_PREFIX + "/userMpOpenId")
	public R<String> getOpenIdByMpIdAndUserId(String mpId, String userId) {
		return mpService.getOpenIdByMpIdAndUserId(mpId, userId);
	}
}
